 /*
{
"状态":1,
"名称":"获取-店铺权限人员列表",
"作者":"马学兵",
"创建时间":"2018-12-30",
"功能":"获取-店铺权限人员列表",
"log": [
	{"date":"06-01" , "dev" :"hzhh" , "content" : ""}
]
}
*/

--前端调用
DECLARE @dict_id VARCHAR(10) 
DECLARE @user_id varchar(100)  

--
set @dict_id=dbo.ft_checkparavalue('{dict_id}','dict_id','') 
set @user_id=dbo.ft_checkparavalue('{user_id}','user_id','')

 

SELECT  entity_right_key,B.user_name,val FROM b_entity_right A LEFT JOIN dbo.y_user B ON A.user_key=B.user_key WHERE (@user_id='' or A.user_key in (
select user_key from y_user where user_id like @user_id+'%'  or user_name like @user_id+'%' 
)) and  (@dict_id='' or  attribute=CASE  @dict_id
	WHEN '10801' THEN 'all'
	WHEN '10802' THEN 'entity_code'
	WHEN '10803' THEN 'entityName'
	WHEN '10804' THEN 'short_name'
	WHEN '10805' THEN 'entity_type'
	WHEN '10806' THEN 'company'
	WHEN '10807' THEN 'area' 
	WHEN '10808' THEN 'group'
	WHEN '10809' THEN 'province'
	WHEN '10810' THEN 'city'
	WHEN '10811' THEN 'county'
	WHEN '10812' THEN 'supervisor' else '' END)